﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace DevWeb.Biztalk.DeploymentSettings.Data.CodeFirst.Configurations
{
    public class IntegrationVersionParameterConfiguration: ExtendedEntityTypeConfiguration<IntegrationVersionParameter>
    {
        public IntegrationVersionParameterConfiguration()
        {
            Property(p => p.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(p => p.ParameterName).HasMaxLength(250).IsRequired();
            Property(p => p.CreateDateTime).IsRequired();
            HasRequired(p => p.IntegrationVersion);
            HasMany(p => p.IntegrationVersionParameterValues)
                .WithRequired(i => i.IntegrationVersionParameter)
                .HasForeignKey(i => i.IntegrationVersionParameterId);
            HasUnique(p => p.ParameterName).WithColumn(p => p.IntegrationVersionId);

            Ignore(p => p.IntegrationName);
            Ignore(p => p.Version);
            Ignore(p => p.ProductId);


        }
    }
}
